package com.clcao.mybatis.controller.demo;

import com.clcao.mybatis.common.exception.BusinessException;
import com.clcao.mybatis.common.result.Result;
import com.clcao.mybatis.common.result.ResultUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author clcao
 * @since  2025/3/11
 */
@RestController
@RequestMapping("/demo")
public class DemoController {

    @PostMapping("/hello")
    public Result<String> hello() {
        return ResultUtil.ok("hello mybatis!!!");
    }

    @PostMapping("/businessException")
    public Result<String> businessException() {
        throw new BusinessException("test exception");
    }

    @PostMapping("/exception")
    public Result<?> exception() {
        int a = 1/0;

        return ResultUtil.ok();
    }
}
